from rest_framework import serializers
from api import models


#序列化入门
class RoleSerializer(serializers.ModelSerializer):
    class Meta:
        model = models.Roles
        fields = "__all__"


#序列化进阶3，自动序列化连表（depth）
class UserSerializer(serializers.ModelSerializer):
    # 多对多
    class Meta:
        model = models.Users
        fields = "__all__"
        # 连表的深度
        depth = 1


